package com.tarena.lbs.basic.web.controller;

import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.basic.web.assemble.TagAssembler;
import com.tarena.lbs.pojo.basic.vo.ArticleItemTag;
import com.tarena.lbs.pojo.basic.vo.UserItemTag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

//内容标签 用户标签{小程序}
@RestController
public class TagController {
    @Autowired
    private TagAssembler tagAssembler;
    //新增文章 标签数据 aritcleLable 作为小程序端 一个去重聚合的数据返回的
    //内容标签查询
    @GetMapping("/basic/tagLibrary/info/articleAllList")
    public Result<Map<String, List<ArticleItemTag>>> articleTags(){
        Map<String, List<ArticleItemTag>> stringListMap = tagAssembler.assembleArticleTags();
        return new Result<>(stringListMap);
    }
    @GetMapping("/basic/tagLibrary/info/article/tags")
    public Result<Map<String, List<ArticleItemTag>>> articleTagsList(){
        Map<String, List<ArticleItemTag>> stringListMap = tagAssembler.assembleArticleTags();
        return new Result<>(stringListMap);
    }
    //查询 手机小程序用户标签,给用户选择
    @GetMapping("/basic/tagLibrary/info/userList")
    public Result<Map<String, List<UserItemTag>>> userTags(){
        Map<String, List<UserItemTag>> stringListMap = tagAssembler.assembleUserTags();
        return new Result<>(stringListMap);
    }
    @GetMapping("/admin/basic/tagLibrary/info/userList")
    public Result<Map<String, List<UserItemTag>>> userAdminTags(){
        Map<String, List<UserItemTag>> stringListMap = tagAssembler.assembleUserTags();
        return new Result<>(stringListMap);
    }
}
